import { useState, useEffect } from 'react'
import {Route, Routes, Link, useNavigate} from 'react-router-dom'
import './App.css'
import Home from './Home'
import Detail from './Detail'
import User from './User'
function App() {
  // const navigate = useNavigate();
  // useEffect(() => {
  //   setTimeout(()=> {
  //     // js 跳转  BOM 原始
  //     navigate('/post/1111111111111')
  //     // window.location.href = '/post/1111111111111'
  //     // history.pushState(null, null, '/post/1111111111111')
  //   }, 2000)
    
  // }, [])
  return (
    
    <div className="App">
      <nav>
        <Link to="/post?id=6666666666">详情</Link>
        <Link to="/post/1111111111111">详情</Link>
        <Link to="/user">用户</Link>
      </nav>

      <Routes>
        {/* <Route path='/' element={<Home />}/> */}
        <Route path='/post' element={<Detail />}/>
        <Route path='/post/:id' element={<Detail />}/>
        <Route path='/user' element={<User />}/>
      </Routes>
    </div>
  )
}

export default App
